<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title></title>
	<%@include file="/view/resource.jsp" %>
	<link rel="stylesheet" type="text/css" href="${ctx}/css/base.css">
</head>
<body>
<style type="text/css">
	.buttonSend {
		background-color: #009688;
		color: #fff;
		cursor: pointer;
		height: 35px;
		border: none;
		min-width: 60px;
		float: right;
	}

	.buttonSend:hover {
		color: #000;
	}

	.buttonSendWait {
		background-color: #ddd;
		color: #fff;
		height: 35px;
		border: none;
		min-width: 60px;
		float: right;
	}
</style>
<form id="entityForm" name="entityForm" action="${ctx}/terminalCommand/sendShortMessage"
      method="POST">
	<input type="hidden" name="dvcId" id="dvcId" value='${dvcId}'/>
	<table class="editTable">
		<tr>
			<td class="label" style="width: 60px;min-width: 60px;">内容</td>
			<td colspan="3">  <textarea style="width: 430px;height:80px;" id="cmdContent" maxlength="30"
			                            class="topjui-ueditor" name="cmdContent"></textarea>
			</td>
		</tr>
		<tr>
			<td class="label" style="width: 60px;min-width: 60px;"></td>
			<td colspan="3" style="font-weight: bold;">
				<span class="commandMsg" style="display:inline-block;margin-top: 10px;"></span><input id="btnSend" class="buttonSend"
				                                       type="button" value="发送"
				                                       onclick="send();"/></td>
		</tr>
	</table>
</form>
<%--<div style="width: 500px;border-width:0px;margin-top: 50px; " class="dialog-button">
	<input id="btnSend" class="buttonSend" type="button" value="发送" onclick="send();"/>
</div>--%>
<script type="text/javascript" src="${ctx}/js/common/package.js"></script>
<script type="text/javascript" src="${ctx}/js/common/base.js?v=11"></script>
<script type="text/javascript" src="${ctx}/js/jquery/jquery.timers.js"></script>
<!--定时器-->
<script type="text/javascript" src="${ctx}/js/terminalCommand/terminalCommand.js"></script>
<script type="text/javascript" src="${ctx}/js/terminalCommand/sendMessageWait.js"></script>
<!--终端命令结果查询-->
<script type="text/javascript" charset="utf-8">
	var dvcId = ${dvcId};

	function send() {
		var data = {};
		var cmdContent = $.trim($('#cmdContent').val());
		if (cmdContent == '') {
			$('.commandMsg').html('请输入内容!');
			return;
		}
		if ($("#entityForm").form('validate')) {
			Bdth.submitForm($("#entityForm"), data, function (result) {
				if (result.success) {
					//var commandId = result.dvcId; //下发成功后，获取到命令Id
					//TerminalCommand.startQueryResult(commandId); //命令下发成功,根据命令id,开始尝试获取检索结果
					$(".commandMsg").html("发送成功");
					SendMessageWait.settime($("#btnSend"));
				}
				else {
					$(".commandMsg").html("提交失败! 错误原因：" + (result.msg ? result.msg : result.msg));
					//停止所有的在$('body')上定时器
					//$('body').stopTime();
				}
			});
		}
	}
</script>
</body>
</html>
